#ifndef BASE_VOIP_TCP_VERIFY_THREAD_H_
#define BASE_VOIP_TCP_VERIFY_THREAD_H_

#include "ct_thread.h"
#include "ctType.h"
#include "ct_tcp_srv.h"
#include "ct_voip_tcp_task.h"
#include <sys/epoll.h>


class ctVOIPThreadPool;
class ctVOIPTCPConnectThread:
        public ctThread,
        public ctVOIPTCPTaskQueue
{
        public:
                ctVOIPTCPConnectThread(
                                ctVOIPThreadPool *pool,
                                const std::string &name = std::string("VOIP-TCP-Connect-Thread"))
                        : ctThread(name), pool_(pool)
                {
                }

                ~ctVOIPTCPConnectThread()
                {
                        SAFE_DELETE(tcp_server_);
                }

                bool init(const WORD &port);
                void run();
                void newTCPTask(const int sock,const struct sockaddr_in *addr);
                void _add(ctVOIPTCPTask *task);

        private:
                ctVOIPThreadPool *pool_;
                ctTCPServer *tcp_server_;

                ctTCPTaskContainer recycle_tasks_;
};

#endif //BASE_VOIP_TCP_VERIFY_THREAD_H_
